import Login from '@/views/public/login'
import Register from '@/views/public/register'
import FindPassword from '@/views/public/find-password'
import ResetPassword from '@/views/public/reset-password'
import NotFound from '@/views/public/404'
import NotAllowed from '@/views/public/401'
import Help from '@/views/public/help'
import About from '@/views/public/help/about'
import Terms from '@/views/public/terms'

export const urlWhiteList = [
  '/',
  '/login',
  '/register',
  '/find-password',
  '/reset-password',
  '/authredirect',
  '/help',
  '/help/about',
  '/terms'
] // no redirect whitelist

export const apiWhiteList = [
  '/auth/signIn',
  '/auth/signUp',
  '/auth/signUp'
]

export const asyncRoutes = (() => {
  const emptyPath = [{ path: '*', redirect: '/404', hidden: true }]
  let routerMap = [
    {
      path: '/dashboard',
      component: () => import('@/views/dashboard'),
      meta: {
        title: '面板',
        icon: 'dashboard',
        affix: true
      }
    }
  ]
  /*Object.keys()
  for (let key in groupRouterMap) {
    routerMap = routerMap.concat(groupRouterMap[key]);
  }*/
  return routerMap.concat(emptyPath)
})()

export const constantRoutes = [
  {
    path: '/login',
    component: Login, //() => import('@/views/public/login'),
    meta: {
      title: '登录'
    },
    hidden: true
  },
  {
    path: '/register',
    component: Register, // () => import('@/views/public/register'),
    meta: {
      title: '注册'
    },
    hidden: true
  },
  {
    path: '/find-password',
    component: FindPassword, //() => import('@/views/public/find-password'),
    meta: {
      title: '找回密码'
    },
    hidden: true
  },
  {
    path: '/reset-password',
    component: ResetPassword,
    meta: {
      title: '重置密码'
    },
    hidden: true
  },
  {
    path: '/',
    component: () => import('@/views/landing'),
    meta: {
      title: '首页'
    },
    hidden: true
  },
  {
    path: '/404',
    component: NotFound, //() => import('@/views/public/404'),
    meta: {
      title: '404'
    },
    hidden: true
  },
  {
    path: '/401',
    component: NotAllowed, //() => import('@/views/public/401'),
    meta: {
      title: '401'
    },
    hidden: true
  },
  {
    path: '/help',
    component: Help,
    meta: {
      title: '帮助'
    },
    hidden: true
  },
  {
    path: '/help/about',
    component: About,
    meta: {
      title: '关于 - 帮助'
    },
    hidden: true
  },
  {
    path: '/terms',
    component: Terms,
    meta: {
      title: '服务协议 - 帮助'
    },
    hidden: true
  }
]
